package com.deer.wms.ware.task.model.pushErp.enter;

import com.deer.wms.base.system.model.OrderDetailBO;
import com.deer.wms.base.system.model.OrderToErpBO;
import com.deer.wms.ware.task.model.SO.SoDetail;
import com.deer.wms.ware.task.model.SO.SoMaster;
import com.deer.wms.ware.task.model.enums.ErpType;
import com.deer.wms.ware.task.model.pushErp.AbstractPushErpBean;
import com.deer.wms.ware.task.service.PushErpService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 * @Author: xu
 * @Date: 2022/10/08/11:58
 * @Description:
 */
public class HandAllot extends AbstractPushErpBean {

    @Autowired
    private PushErpService pushErpService;

    public ErpType gainType() {
        return new ErpType(null, 41);
    }

    protected  Boolean front(SoMaster soMaster, List<SoDetail> soDetail ){
        return true;
    }
    /**
     * 字段添加
     *
     * @param orderToErpBO
     * @param
     * @param
     */
    @Override
    protected void add(OrderToErpBO orderToErpBO, SoMaster soMaster, Map<String, SoDetail> soDetailMap) {
        for (OrderDetailBO detail : orderToErpBO.getDetails()) {
            SoDetail soDetail = soDetailMap.get(detail.getDetailNo());
            detail.setStockId2(soDetail.getToStockId());
        }

    }

    protected void pushErp(OrderToErpBO orderToErpBO) {
        pushErpService.CreateIMBill(orderToErpBO);
    }
}
